package com.wyj.springmvc.framework;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * TODO:
 *
 * @author wuyijie
 * @date 2021/11/23 23:25
 */
public class Handler {
    //调用类
    private Object controller;
    //方法
    private Method method;
    //url正则
    private Pattern pattern;
    //参数名称及下标映射
    private Map<String,Integer> parameterIndexMapping;

    public Handler() {
        this.parameterIndexMapping = new HashMap<>();
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }

    public Map<String, Integer> getParameterIndexMapping() {
        return parameterIndexMapping;
    }

    public void setParameterIndexMapping(Map<String, Integer> parameterIndexMapping) {
        this.parameterIndexMapping = parameterIndexMapping;
    }

    @Override
    public String toString() {
        return "Handler{" +
                "controller=" + controller +
                ", method=" + method +
                ", pattern=" + pattern +
                ", parameterIndexMapping=" + parameterIndexMapping +
                '}';
    }
}
